/*
 * FacesPortletUtil.java
 *
 * Created on 2 de junio de 2006, 9:35
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package gestionportletlogscarguegestion;

import javax.faces.context.FacesContext;
import javax.portlet.PortalContext;
import javax.portlet.PortletContext;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSession;

/**
 *
 * @author root
 */
public class FacesPortletUtil {
    public static PortletContext getPortletContext(FacesContext faces) {
        return (PortletContext)faces.getCurrentInstance().getExternalContext().getContext();
    }
    public static PortletRequest getPortletRequest(FacesContext faces) {
        return (PortletRequest)faces.getCurrentInstance().getExternalContext().getRequest();
    }
    public static PortletSession getPortletSession(FacesContext faces) {
        return (PortletSession)faces.getCurrentInstance().getExternalContext().getSession(true);
    }
    
    public static PortletResponse getPortletResponse(FacesContext faces) {
        return (PortletResponse)faces.getCurrentInstance().getExternalContext().getResponse();
    }
    
    public static PortletPreferences getPortletPreferences(FacesContext faces) {
        return (PortletPreferences)getPortletRequest(faces).getPreferences();
    }
    public static PortalContext getPortalContext(FacesContext faces) {
        return getPortletRequest(faces).getPortalContext();
    }   
}
